<#assign module="notice"/>

<@override name="header">
<link rel="stylesheet" href="${ctx}/assets/css/bootstrap-multiselect.css">
<link rel="stylesheet" href="${ctx}/assets/css/datetimepicker.css">
</@override>
<@override name="body">
	<div class="row">
		<div class="col-md-12">
			<div class="panel panel-default" style="min-height:610px;">
				<div class="panel-heading">
					赠送优惠券
					<label class="control-label"><font color="red">（带*表示必填项）</font></label>
			    </div>
			    <div class="panel-body">
    				<form id="submit_form" action="${ctx}/activity/giftCoupon" class="form-horizontal" method="post">
		               <input type="hidden" id="activityEvent" name="activityEvent" value="adminGift" />
		                <h4>筛选条件</h4>
		                <hr/>
		                <h5>单个客户：</h5>
		                <div class="form-group">
		                	<label class="col-sm-3 control-label">车牌号：</label>
		                	<div class="col-sm-3">
								<input class="form-control" type="text" id="carNumber" name="carNumber" />
							</div>
						</div>
						
					    <div class="form-group">
					    
							<label class="col-sm-3 control-label">客户姓名：</label>
		                	<div class="col-sm-3">
								<input class="form-control" type="text" id="name" name="name" />
							</div>
							
					    </div>
					    <div class="form-group">
					    
							<label class="col-sm-3 control-label">客户电话：</label>
		                	<div class="col-sm-3">
								<input class="form-control" type="text" id="phone" name="phone" />
							</div>
							
					    </div>
					    <h5>多个客户：</h5>
					    <hr/>
					    <@shiro.isMainCompany>
		               		<div class="form-group">
			                    <label class="col-sm-3 control-label">所属公司：</label>
			                    <div class="col-sm-3">
			                    	<input type="hidden" id="companyNames" name="companyNames" value="" />
			                    	<select class="form-control" id="companyIds" name="companyIds" multiple="multiple" required>
			                    		<#if companys??>
			                    			<#list companys as company>
			                    				<option value="${company.id}">${company.abbreviation?if_exists}</option>
			                    			</#list>
			                    		</#if>
			                    	</select>
			                    </div>
			                </div>
		               	</@shiro.isMainCompany>
		               	
		               	<div class="form-group">
		                    <label class="col-sm-3 control-label">注册时间：</label>
		                    <div class="col-sm-3">
		                    	<input class="form-control" id="startTime" name="startTime" type="text" />
		                    </div>
		                    <label style="float:left;" class="control-label">-</label>
		                    <div class="col-sm-3">
		                    	<input class="form-control" id="endTime" name="endTime" type="text" />
		                    </div>
		                </div>
		               	
					    <div class="form-group">
					    	<label class="col-sm-3 control-label">客户等级：</label>
		                	<div class="col-sm-9">
		                		<p class="form-control-static">
		                			<#if grades??>
		                				<#list grades as grade>
											<label style="padding-right:12px;">
											  <input type="checkbox" name="gradeIds" value="${grade.id}"/> ${grade.name?if_exists}
											</label>
										</#list> 
									</#if>
								</p>
							</div>
					    </div>
					    
					    <div class="form-group">
					    	<label class="col-sm-3 control-label">客户类型：</label>
		                	<div class="col-sm-9">
		                		<p class="form-control-static">
									<label style="padding-right:12px;">
									  <input type="checkbox" name="type" value="0"/> 个人用户
									</label>
									<label style="padding-right:12px;">
									  <input type="checkbox" name="type" value="1"/> 企业用户
									</label>
								</p>
							</div>
					    </div>
					    
					    <div class="form-group">
					    	<label class="col-sm-3 control-label">是否签单：</label>
		                	<div class="col-sm-9">
		                		<p class="form-control-static">
									<label style="padding-right:12px;">
									  <input type="checkbox" name="allowOverdraw" value="true"/> 是
									</label>
									<label style="padding-right:12px;">
									  <input type="checkbox" name="allowOverdraw" value="false"/> 否
									</label>
								</p>
							</div>
					    </div>
					    
					    <div class="form-group">
		                    <label class="col-sm-3 control-label">使用时间：</label>
		                    <div class="col-sm-5">
		                    	<div class="input-group">
		                    		<span class="input-group-addon">超过</span>
					            	<input class="form-control" id="overDay" name="overDay" type="number" min="1" />
					            	<span class="input-group-addon">天未使用</span>
					            	<select class="form-control" id="orderType" name="orderType">
			                    		<option value="">--请选择--</option>
			                    		<@daijia>
			                    		<option value="daijia">代驾</option>
			                    		</@daijia>
			                    		<@zhuan>
			                    		<option value="zhuanche">专车</option>
			                    		</@zhuan>
			                    		<@pao>
			                    		<option value="errand">跑腿</option>
			                    		</@pao>
			                    		<@freight>
			                    		<option value="freight">货运</option>
			                    		</@freight>
			                    		<@zhuanxian>
			                    		<option value="zhuanxian">快车</option>
			                    		</@zhuanxian>
			                    	</select>
			                    	<span class="input-group-addon">业务</span>
				                </div>
		                    </div>
		                </div>
					    
					    <h4>优惠券选择</h4>
					    <hr/>
					    <input type="hidden" id="activityType" name="activityType" value="${type}" />
						     
					    <div class="form-group coupon_div" id="first_coupon_div"> 
					    	<input type="hidden" id="couponRuleId" name="couponRuleId" >
	                		<input type="hidden" id="amount" name="amount" >
					    
					    	<label class="col-sm-3 control-label"><em>*</em>优惠券选择：</label>
						    <div class="col-sm-3">
		                    	<select class="form-control couponRule_select">
		                    		<option value="">请选择优惠券</option>
		                    		<#if coupons??>
			                    		<#list coupons as coupon>
			                    			<option value="${coupon.id}" eachLimit="${coupon.eachLimit}" numerAll="${coupon.number}">
			                    				${coupon.title?if_exists}
			                    				<#if coupon.timeStatus==0>
													(未开始)
												<#elseif coupon.timeStatus==1>
													(使用中)
												</#if>
												&nbsp;&nbsp;&nbsp;&nbsp;
												${coupon.company.companyName?if_exists}
			                    			</option>
			                    		</#list>
		                    		</#if>
		                    	</select>
		                    </div>
				                    
					    	<label style="float:left;" class="control-label"><em>*</em>数量：</label>
		                    <div class="col-sm-1">
		                    	<input class="form-control couponAmount" data-toggle="tooltip"  title="（小提示：所填数量为当前优惠券每人领取数量）" type="number" min="1" value="1"/>
		                    </div>
		                    
		                    <div class="col-sm-3" id="coupon_add_div" >
		                    	<button type="button" id="add_coupon" class="btn btn-default">
								  <span class="glyphicon glyphicon-plus-sign"></span> 添加
								</button>
		                    </div>
						</div>

					    
					    <h4>通知方式</h4>
		                <hr/>
		                
		                <div class="form-group">
					    	<label class="col-sm-3 control-label">通知方式：</label>
		                	<div class="col-sm-9">
		                		<p class="form-control-static">
								<!--	<label style="padding-right:12px;"> 
									  <input type="checkbox" name="messageType" value="sms" checked="checked"/> 短信
									</label>  -->
									<label style="padding-right:12px;">
									  <input type="checkbox" name="messageType" value="message" checked="checked"/> 应用通知
									</label>  
								</p>
							</div>
					    </div>
		                
		                <div class="form-group" style="margin-left:10px;">
			                <label class="col-sm-3 control-label"></label>
			                <input id="submit_button" type="button" class="btn btn-primary" value="赠送">
			                <input type="button" class="btn btn-default" onclick="window.location.href = '${ctx}/activity/list?event=newRegister&type=${type}';" value="返回">
			            </div>
			            
					</form>
        		</div>
			</div>
		</div>
	</div>

</@override>
<@override name="footer">
<script type="text/javascript">
	$("#numbers").tooltip($("[data-toggle='tooltip']").tooltip());
</script>
<script src="${ctx}/assets/js/bootstrap-multiselect.js"></script>
<script src="${ctx}/assets/js/bootstrap-datetimepicker.min.js"></script>
<script src="${ctx}/assets/js/bootstrap-datetimepicker.zh-CN.js"></script>
<script src="${ctx}/assets/js/datepicker.js"></script>
<script src="${ctx}/assets/js/activity/addadmingift.js"></script>
</@override>
<@extends name="../layout.ftl"/>